Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

syncer: fix panic when concurrent call Status #2115

Merged
merged 5 commits into from
Sep 9, 2021

Conversation

lance6716
Copy link
Collaborator

@lance6716 lance6716 commented Sep 9, 2021

What problem does this PR solve?

before #2076, the first print status is happened after a tick (30s), so s.start is very likely initialized. After that PR it's more possible that race happened and further cause a panic.

What is changed and how it works?

use atomic type and check zero before division.

Check List

Tests

  • Unit test

Related changes

  • Need to cherry-pick to the release branch

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Sep 9, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Ehco1996
  • GMHDBJD

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@lance6716 lance6716 added the needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 label Sep 9, 2021
@lance6716
Copy link
Collaborator Author

/cc @GMHDBJD

syncer/status_test.go Outdated Show resolved Hide resolved
syncer/status_test.go Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added the status/LGT1 One reviewer already commented LGTM label Sep 9, 2021
Copy link
Collaborator

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot ti-chi-bot added status/LGT2 Two reviewers already commented LGTM, ready for merge and removed status/LGT1 One reviewer already commented LGTM labels Sep 9, 2021
@lance6716
Copy link
Collaborator Author

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 9f22f7a

@ti-chi-bot
Copy link
Member

@lance6716: Your PR was out of date, I have automatically updated it for you.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #2118.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 size/L status/can-merge status/LGT2 Two reviewers already commented LGTM, ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants